<extend name="Public/base"/>

<block name="body">
    <style>
        #userForm input[type="checkbox"] {
            margin: 0px 5px;
        }
        .list-group-item {
            width:20%;
            float:left;
        }

    </style>
    <div class="panel  panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">权限配置</h3>
        </div>
        <div class="panel-body">
            <form action="__URL__/setUser" method="post" class="pageForm required-validate" id="userForm">
                <div class="box-body">
                <input type="hidden" name="groupId" VALUE="{$Think.get.id}" />
                <ul class="list-group">
                    <volist id="item" name="userList">
                    <li class="list-group-item">
                        <input type="checkbox" name="groupUserId[]" value="{$key}" <?php echo in_array($key, $groupUserList) ? "checked" : "" ?>/>{$item}
                    </li>
                    </volist>
                </ul>
                </div>
                <div class="box-footer">
                    <p class="pull-left"><label><input type="checkbox" class="checkboxCtrl" group="groupUserId[]" />Select All</label></p>
                    <button type="submit" class="btn btn-primary pull-right">save</button>
                </div>
            </form>
        </div>
    </div>

</block>
<block name="script">
    <script type="text/javascript">
        iniAjaxFormDetail('#userForm','__URL__');
        $(".checkboxCtrl").change(function(){
            if($(this).prop("checked")==true) {
                $(".list-group-item").find("input[type='checkbox']").prop("checked",true);
            } else {
                $(".list-group-item").find("input[type='checkbox']").prop("checked",false);
            }
        })
    </script>

</block>
